﻿<CodeSnippetTabbed DocLink="https://docs.devexpress.com/Blazor/DevExpress.Blazor.DxDataGrid-1.DataAsync">
    <CodeSnippetTabPage Text="Razor">@(@"<DxDataGrid ...
            DataAsync=""@SupplierService.GetSuppliersAsync"">
    <DxDataGridColumn Field=""@nameof(Supplier.SupplierName)"" />
    <DxDataGridComboBoxColumn Field=""@nameof(Supplier.SupplierCategoryID)"" Caption=""Category"" DataAsync=""@SupplierService.GetSupplierCategoriesAsync""
                              ValueFieldName=""@nameof(Supplier.SupplierCategoryID)"" TextFieldName=""@nameof(SupplierCategory.SupplierCategoryName)"" />
    <DxDataGridComboBoxColumn Field=""@nameof(Supplier.DeliveryMethodID)"" Caption=""Delivery Method"" DataAsync=""@SupplierService.GetDeliveryMethodsAsync""
                              ValueFieldName=""@nameof(DeliveryMethod.DeliveryMethodID)"" TextFieldName=""@nameof(DeliveryMethod.DeliveryMethodName)""  />
    <DxDataGridColumn Field=""@nameof(Supplier.PhoneNumber)"" />
    <DxDataGridColumn Field=""@nameof(Supplier.BankAccountBranch)"" />
    <DxDataGridColumn Field=""@nameof(Supplier.BankAccountNumber)"" />
</DxDataGrid>
@code {
    [Inject] protected SupplierService SupplierService { get; set; }
}")</CodeSnippetTabPage>
    <CodeSnippetTabPage Text="Data Source" Language="csharp">@(@"public class SupplierService {
    ...
    private List<Supplier> Suppliers { get; set; }
    private List<SupplierCategory> SupplierCategories { get; set; }
    private List<DeliveryMethod> DeliveryMethods { get; set; }
    public async Task<IEnumerable<Supplier>> GetSuppliersAsync(CancellationToken ct = default) {
        await Task.Delay(1000);//For demonstration purposes, emulate that data is get from an external storage with a delay.
        return Suppliers;
    }
    public async Task<IEnumerable<SupplierCategory>> GetSupplierCategoriesAsync(CancellationToken ct = default) {
        await Task.Delay(1000);//For demonstration purposes, emulate that data is get from an external storage with a delay.
            return SupplierCategories;
    }
    public async Task<IEnumerable<DeliveryMethod>> GetDeliveryMethodsAsync(CancellationToken ct = default) {
        await Task.Delay(1000);//For demonstration purposes, emulate that data is get from an external storage with a delay.
        return DeliveryMethods;
    }
}")</CodeSnippetTabPage>
</CodeSnippetTabbed>
